<template>
	<view class="bind-phone flex items-center justify-center" v-if="value">
		<view class="box">
			<view class="a">
				HI,请绑定手机号
			</view>
			<view class="b">
				绑定手机号即可参加
			</view>
			<button class="c" open-type="getPhoneNumber" @getphonenumber="bindPhone">
			  <view class="a">授权绑定</view>
			</button>
			<view class="d" @click="close">取消</view>
		</view>
	</view>
</template>

<script>
	import { baseUrl, request } from "@/utils/request.js";
	
	export default {
		data() {
			return {

			}
		},
		props:{
			value:{
				type:Boolean,
				default:false
			}
		},
		emits: ['bindPhone', 'closeBind'],
		methods: {
			bindPhone(res) {
			  if (res.detail.code) {
			    request("/api/bindPhone", { code: res.detail.code }, "get").then(
			      (res) => {
			        if (res.data.code === 200) {
					  this.$emit('bindPhone')
			        }
			      }
			    );
			  }
			},
			close() {
				this.$emit('closeBind')
			}
		},
	}
</script>

<style lang="less" scoped>
	.bind-phone {
		position: fixed;
		background: rgba(0, 0, 0, 0.5);
		z-index: 9;
		top: 0;
		left: 0;
		width: 100vw;
		height: 100vh;
		text-align: center;
		.box {
			width: 636rpx;
			height: 434rpx;
			background: #FFFFFF;
			border-radius: 16rpx 16rpx 16rpx 16rpx;
			.a {
				font-size: 40rpx;
				font-family: Source Han Sans CN, Source Han Sans CN;
				font-weight: 500;
				color: #333333;
				line-height: 48rpx;
				margin: 62rpx 0 32rpx 0;
			}
			.b {
				font-size: 32rpx;
				font-family: Source Han Sans CN, Source Han Sans CN;
				font-weight: 400;
				color: #666666;
				line-height: 48rpx;
			}
			.c {
				padding: 0;
				margin: 0;
				background: transparent;
				display: flex;
				justify-content: center;
				.a {
					width: 526rpx;
					height: 84rpx;
					background: #E21D1D;
					border-radius: 46rpx 46rpx 46rpx 46rpx;
					font-size: 28rpx;
					font-family: Source Han Sans CN, Source Han Sans CN;
					font-weight: 400;
					color: #FFFFFF;
					line-height: 84rpx;
				}
				&::after {
					display: none;
				}
			}
			.d {
				font-size: 28rpx;
				font-family: Source Han Sans CN, Source Han Sans CN;
				font-weight: 400;
				color: #666666;
				line-height: 48rpx;
			}
		}
	}
</style>